layui.use(['form', 'jquery'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.jquery;


    form.on('submit(login)', function (data) {
        console.log(data)
        $.ajax({
            type: "post",
            url: ctx + "/user/login",
            data: {
                username: data.field.username,
                password: data.field.password,
                rememberMe: data.field.rememberMe
            }
            , success: function (result) { //接收后端数据
                console.log(result)
                if (result.code == 100) {
                    window.location.href = ctx + "/main"
                } else if (result.code == 200) {
                    window.location.href = ctx + "/uIndex"
                } else {
                    layer.msg(result.msg, {icon: 5})
                }
            }

        });
        return false;
    });


});